From a802ad78c37b3ce53ae66e3a0188f9f12c5c76a0 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Thu, 25 Jan 2007 16:58:21 +0000 Subject: [PATCH] netfront: Better fix for netfront_tx_slot_available(). Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c index 01ccb15b72..f54cc84b89 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c @@ -613,11 +613,8 @@ static int network_open(struct net_device *dev) static inline int netfront_tx_slot_available(struct netfront_info *np) { - /* XXX Need to check we have enough grants for worst-case fragments. */ - if (gnttab_empty_grant_references(&np->gref_tx_head)) - return 0; - - return RING_FREE_REQUESTS(&np->tx) >= MAX_SKB_FRAGS + 2; + return ((np->tx.req_prod_pvt - np->tx.rsp_cons) < + (TX_MAX_TARGET - MAX_SKB_FRAGS - 2)); } static inline void network_maybe_wake_tx(struct net_device *dev) -- 2.30.2